package com.yjc.rabbitMQ.two;

import com.rabbitmq.client.CancelCallback;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;
import com.rabbitmq.client.Delivery;
import com.yjc.rabbitMQ.utils.RabbitMQUtils;

/**
 * @author shkstart
 * @create 2022-07-30 15:32
 */
public class Worker01 {

    private static final String QUEUE_NAME = "Hello_queue_product *(￣▽￣)";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMQUtils.getChannel();
        System.out.println("C2接收消息");
        DeliverCallback deliverCallback = (consumerTag, message) -> {
            System.out.println(new String(message.getBody()));
        };
        CancelCallback cancelCallback = (consumerTag) -> {
            System.out.println("消息被取消了");
        };

        channel.basicConsume(QUEUE_NAME, true, deliverCallback, cancelCallback);
    }
}
